
$(function() {

	$("a[id^='computer_']").click(function() {
		return false;
	});

});

function a1(e, p2, id, status) {
	$.cookie('id_', id);

	$.cookie('status_', status);

	p2 = query(p2);
	$.cookie('p2', p2);

	var c1 = 'tel.php?do=Black.edit&id=' + id;	
	var c2 = 'tel.php?do=Black.view&id=' + id;

	var a1 = ['编辑信息', 'url', 'dialog_edit_', '500x300', '编辑信息'];
	var a2 = ['查看信息', 'url', 'dialog_view_', '500x300', '查看信息'];

	var s = c1 + ", " + c2;

	return popup(e, [a1, a2], s);	
}

function dialog_edit_(url, title, xy) {
	$('#dialog_edit').dialog('option', 'buttons', {

		"关闭": function() { 
			$(this).dialog("close");
		},
		
		"修改": function() {
			if (!confirm("确认是否提交？")) {
				return false;
			}

			var form = $("#form_edit")[0];

			var body = {};
			body.id = form.id.value;
			body.exten = form.exten.value;
			body.code = form.code.value;
			body.zone = form.zone.value;
			body.content = form.content.value;
			body.status = form.status.value;

			$(this).dialog("close");
			
			var url = 'tel.php?do=Black.editPost';
			var p2 = $.cookie('p2');
			if (p2 != null) {
				url += p2;
			}

			$.post(url, body, function(data) {
				$('#result').html(data);
			});
		}
	});

	dialog_edit(url, title, xy);
}

function dialog_view_(url, title, xy) {
	$('#dialog_view').dialog('option', 'buttons', {

		"关闭": function() { 
			$(this).dialog("close");
		}
	});

	dialog_view(url, title, xy);
}